#ifndef WHEELSPINSENSOR_H
#define WHEELSPINSENSOR_H

#include <string>
#include <fstream>

#include "Object.h"

//! This class simulates a wheelspinsensor
/*!
The class WheelSpinSensor simulates a Wheelspinsensor. It sequentially reads
a file which contains values for the wheelspin.
Should be called every 500 ms via the Process function of the PKW.
\class WheelSpinSensor
\author Thomas Pfeiffer
\date 13.11.2012
*/
class WheelSpinSensor : public Object{
public:

	//! Ctor of the WheelSpinSensor class
	/*!
	The only CTor of the WheelSpinSensor.
	\param filename The filename of the file which contains the sensor data (revolutions).
	*/
	WheelSpinSensor(std::string filename) : mFilename(filename) {}

	//! DTor of the WheelSpinSensor class
	/*!
	The destructor free the resources used by the object.
	*/
	~WheelSpinSensor();

	//! Read the revolutions from a file and return it.
	/*! 
	The function GetRevolutions() reads a value from a file and
	returns it. The read value is the current revolution of the 
	PKW.
	\returns 0 if EOF reached.
	\throws std::exception when the file can't be opened or when
	the file has a faulty format (e.g. contains letters).
	*/
	size_t GetRevolutions();
private:
	std::string mFilename;
	std::ifstream mFile;
};

#endif